
//发送验证码
var InterValObj; //timer变量，控制时间
// var count = 60; //间隔函数，1秒执行
var curCount=60; //当前剩余秒数

function SetRemainTime() {
    if (curCount == 0) {
        window.clearInterval(InterValObj);
        //停止计时器
        $("#send-validation").removeAttr("disabled");
        //启用按钮
        $("#send-validation").html("重新获取");
        curCount=60;
    } else {
        curCount--;
        $("#send-validation").html(curCount + "秒");
    }
}
$('#send-validation').on('click', function (e) {

    $("#send-validation").attr("disabled", "true");
    $("#send-validation").html(curCount + "秒");
    InterValObj = window.setInterval(SetRemainTime, 1000); //启动计时器，1秒执行一次

    $.post("/sendValidateCode",
        { "bizType": "USER_INFO_MODIFY"},
        function(result) {

            $.alert(result.message)
    })
});

$("#save_btn").on('click',function () {

    var id=$(" input[ name='id' ] ").val();
    var trueName=$(" input[ name='trueName' ] ").val();
    var idCard=$(" input[ name='IdCard' ] ").val();
    var email=$(" input[ name='email' ] ").val();
    var code=$(" input[ name='code' ] ").val();

    if(code=="" || code==undefined || code==null){
        $.alert('请输入验证码');
        return;
    }

    var param={
        id:id,
        trueName:trueName,
        IdCard:idCard,
        email:email,
        code:code
    }
    $.post("/user_center/updateUserInfo",param,
        function (result) {
            $(" input[ name='code' ] ").val('');
            $.alert(result.message)
        }
    )

})